<link rel="stylesheet" href="style/calendrier.css" type="text/css" media="screen" />

<script type="text/javascript" src="modeles/jquery.js"></script>
<script type ="text/javascript" src="modeles/javascriptFonctions.js"></script>
<script type ="text/javascript" src="modeles/calendrier.js"></script>

<?php
	if(isset($_SESSION["message"]))
	{
		echo $_SESSION["message"];
		unset($_SESSION["message"]);
	}
?>

	<h2>Tableau de bord</h2>
	<h3>Récapitulatif</h3>
	
	<table>
		<tr>
			<th colspan="2"><a href="index.php?module=administration&action=tableauDeBord&adc=visionnerTout"><?php echo count(ActionDeCommunication::getAllADC($filtreA))+count(Forum::getAllForumAdmin($filtreF))?> actions de communication</a></th>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADC($filtreA))  ==  0)
				echo count(ActionDeCommunication::getAllADC($filtreA)).' action';
			elseif (count(ActionDeCommunication::getAllADC($filtreA))  ==  1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=toutes"> '.count(ActionDeCommunication::getAllADC($filtreA)).' action</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=toutes"> '.count(ActionDeCommunication::getAllADC($filtreA)).' actions</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumAdmin($filtreF))  ==  0)
				echo count(Forum::getAllForumAdmin($filtreF)).' forum';
			elseif (count(Forum::getAllForumAdmin($filtreF))  ==  1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=tous"> '.count(Forum::getAllForumAdmin($filtreF)).' forum</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=tous"> '.count(Forum::getAllForumAdmin($filtreF)).' forums</a>';
			?>
		</td>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADCIncompletes($filtreA))  ==  0)
				echo count(ActionDeCommunication::getAllADCIncompletes($filtreA)).' à compléter';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=incompletes"> '.count(ActionDeCommunication::getAllADCIncompletes($filtreA)).' à compléter</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumIncomplets($filtreF))  ==  0)
				echo count(Forum::getAllForumIncomplets($filtreF)).' à compléter';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=incomplets"> '.count(Forum::getAllForumIncomplets($filtreF)).' à compléter</a>';
			?>
		</td>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADCEtat(1,$filtreA)) == 0)
				echo count(ActionDeCommunication::getAllADCEtat(1,$filtreA)).' ouverte';
			elseif (count(ActionDeCommunication::getAllADCEtat(1,$filtreA)) == 1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=ouvertes"> '.count(ActionDeCommunication::getAllADCEtat(1,$filtreA)).' ouverte</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=ouvertes"> '.count(ActionDeCommunication::getAllADCEtat(1,$filtreA)).' ouvertes</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumEtat(1,$filtreF)) == 0)
				echo count(Forum::getAllForumEtat(1,$filtreF)).' ouvert';
			elseif (count(Forum::getAllForumEtat(1,$filtreF)) == 1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=ouverts"> '.count(Forum::getAllForumEtat(1,$filtreF)).' ouvert</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=ouverts"> '.count(Forum::getAllForumEtat(1,$filtreF)).' ouverts</a>';
			?>
		</td>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADCEtat(2,$filtreA)) == 0)
				echo count(ActionDeCommunication::getAllADCEtat(2,$filtreA)).' complete';
			elseif (count(ActionDeCommunication::getAllADCEtat(2,$filtreA)) == 1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=completes"> '.count(ActionDeCommunication::getAllADCEtat(2,$filtreA)).' complète</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=completes"> '.count(ActionDeCommunication::getAllADCEtat(2,$filtreA)).' complètes</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumEtat(2,$filtreF)) == 0)
				echo count(Forum::getAllForumEtat(2,$filtreF)).' complet';
			elseif (count(Forum::getAllForumEtat(2,$filtreF)) == 1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=complet"> '.count(Forum::getAllForumEtat(2,$filtreF)).' complet</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=complets"> '.count(Forum::getAllForumEtat(2,$filtreF)).' complets</a>';
			?>
		</td>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADCEtat(3,$filtreA)) == 0)
				echo count(ActionDeCommunication::getAllADCEtat(3,$filtreA)).' inscriptions closes';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=closes"> '.count(ActionDeCommunication::getAllADCEtat(3,$filtreA)).' inscriptions closes</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumEtat(3,$filtreF)) == 0)
				echo count(Forum::getAllForumEtat(3,$filtreF)).' inscriptions closes';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=clos"> '.count(Forum::getAllForumEtat(3,$filtreF)).' inscriptions closes</a>';
			?>
		</td>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADCEtat(4,$filtreA)) == 0)
				echo count(ActionDeCommunication::getAllADCEtat(4,$filtreA)).' terminée';
			elseif (count(ActionDeCommunication::getAllADCEtat(4,$filtreA)) == 1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=terminees"> '.count(ActionDeCommunication::getAllADCEtat(4,$filtreA)).' terminée</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=terminees"> '.count(ActionDeCommunication::getAllADCEtat(4,$filtreA)).' terminées</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumEtat(4,$filtreF)) == 0)
				echo count(Forum::getAllForumEtat(4,$filtreF)).' terminé';
			elseif (count(Forum::getAllForumEtat(4,$filtreF)) == 1)
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=termines"> '.count(Forum::getAllForumEtat(4,$filtreF)).' terminé</a>';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=termines"> '.count(Forum::getAllForumEtat(4,$filtreF)).' terminés</a>';
			?>
		</td>
		</tr>
		<tr>
		<td>
			<?php
			if(count(ActionDeCommunication::getAllADCANoter($filtreA)) == 0)
				echo count(ActionDeCommunication::getAllADCANoter($filtreA)).' à noter';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&adc=anoter"> '.count(ActionDeCommunication::getAllADCANoter($filtreA)).' à noter</a>';
			?>
		</td>
		<td>
			<?php
			if(count(Forum::getAllForumANoter($filtreF)) == 0)
				echo count(Forum::getAllForumANoter($filtreF)).' à noter';
			else
				echo '<a href="index.php?module=administration&action=tableauDeBord&forum=anoter"> '.count(Forum::getAllForumANoter($filtreF)).' à noter</a>';
			?>
		</td>
		</tr>
	</table>
	<?php 
		echo'<form method="POST" action="index.php?module=administration&amp;action=creerADC&retour='.$_GET["module"].'">
			<input class="Ligne1" type="submit" name="CreerOneADC" value="Créer Action"/>
		 </form>';
	?>
	<br/>
	<form action="index.php?module=administration&amp;action=tableauDeBord" method="post" >
		<h3>Actions avant le <?php echo date_format($dateA, 'd/m/Y')?></h3>
		<label for="dateA">Choisissez une date butoir : </label>
		<input size=20 type="text" name="dateA" value="<?php echo date_format($dateA, 'd/m/Y')?>" min="<?php echo $dateJour?>" placeholder="jj/mm/aaaa" class="calendrier""/>
		<input type="submit" name="AfficherADC" value="Afficher"/>
	</form>
	<br/>
	<?php include 'modules/actionComm/vues/visionneuse.php'?>
	<br/>
	<form action="index.php?module=administration&amp;action=tableauDeBord" method="post" >
		<h3>Forums avant le <?php echo date_format($dateF, 'd/m/Y')?></h3>
		<label for="dateF">Choisissez une date butoir : </label>
		<input size=20 type="text" name="dateF" value="<?php echo date_format($dateF, 'd/m/Y')?>" min="<?php echo $dateJour?>"  placeholder="jj/mm/aaaa" class="calendrier"/>
		<input type="submit" name="AfficherForum" value="Afficher"/>
	</form>
	<br/>
	<?php include 'modules/actionComm/vues/visionneuseForum.php';
	
	echo'<br/><h3>Actions proposées</h3>';
	
	
	$adc = ActionDeCommunication::getAllADCEtat(5, TITRE_ADC);
	include 'modules/actionComm/vues/visionneuse.php';
	
	echo'<br/><form action="index.php?module=administration&amp;action=parametres" method="POST" >
			<input class="Ligne1" type="submit" name="Parametres" value="Paramètres"/>
		 </form>';
	?>
	
	